*Tago "Why Do States Formally Invoke the Right of Individual Self-Defense"? replication code

log using "E:\cmps replication.smcl", replace
use "E:\cmps replication", replace
stset   irsd_duration, fail( irsd1)
list ccode1 ccode2 year abbrev1 abbrev2 irsd1 irsd_duration if irsd1==1

*definitions
*irsd1 = official claim of exersicing the right of self-defense/Article 51 
*irsd_duration = days till to a claim of exersicing the right of self-defense/Article 51
*balanced = 1 if balanced==cwhost2
*cwhost2 = COWMIDs hostility level for state B
*noalliance = if a state "ccode1" and a state "ccode2" are not holding any type of alliance tie 
*fms01 = US Foreign Military Sales to a state "ccode1" (if sales exist, coded=1)
*militaryaid = US general (i.e. any type of) military aid to a state "ccode1"
*defensepact = defense pact with the US (if it exists, 1 is coded)
*contiguity = coded 1 if distance is 0

*descriptive statistics
sum irsd1 irsd_duration balanced cwhost2 noalliance fms01 map01 militaryaid defensepact contiguity cwkey
cor irsd1 irsd_duration balanced cwhost2 noalliance fms01 map01 militaryaid defensepact contiguity cwkey

*estimations
*model I (logit: relogit is for a robustness check)
logit irsd1 balanced cwhost2 noalliance militaryaid defensepact contiguity, clust(cwkey) nolog
relogit irsd1 balanced cwhost2 noalliance militaryaid defensepact contiguity, clust(cwkey)
*model II (logit: relogit is for a robustness check)
logit irsd1 balanced cwhost2 noalliance fms01 defensepact contiguity, clust(cwkey) nolog
relogit irsd1 balanced cwhost2 noalliance fms01 defensepact contiguity, clust(cwkey)
*model III
stcox noalliance militaryaid defensepact contiguity, clust(cwkey) efron nolog nohr
*model IV
stcox noalliance fms01 defensepact contiguity, clust(cwkey) efron nolog nohr
*test for CoxPH models
stcox noalliance fms01 defensepact contiguity, efron clust(cwkey) nolog schoenfeld(schoen*) scaledsch(scaled*)
linktest, efron cluster(cwkey) nolog
stphtest, rank detail
drop schoen* scaled*
stcox noalliance militaryaid defensepact contiguity, efron clust(cwkey) nolog schoenfeld(schoen*) scaledsch(scaled*)
linktest, efron cluster(cwkey) nolog
stphtest, rank detail
drop schoen* scaled*

*Clarify (for Table 4)
estsimp logit irsd1 balanced cwhost2 noalliance fms01 defensepact contig, clust(cwke) sims(10000)
setx median
simqi, listx
simqi, pv
simqi, fd(pr) changex(balanced 0 1)
simqi, fd(pr) changex(cwhost2 4 5)
simqi, fd(pr) changex(noalli 0 1)
simqi, fd(pr) changex(fms01 0 1)

*Robustness checks (see footnotes in Research Design and Results sections)
*including the "rogue states" variable (Cuba; 1961-, Iran; 1979-, Sudan; 1990-, Syria, North Korea, Afghanistan, Iraq; 1990-, Quaddafi Libya): reaction to the Reviewer #1's comment that the results may be biased due to the existence of states that has no chance of obtaining the aid from the US
logit irsd1 balanced cwhost2 noalliance fms01 defensepact contiguity rogue, clust(cwkey) nolog
logit irsd1 balanced cwhost2 noalliance militaryaid defensepact contiguity rogue, clust(cwkey) nolog
stcox noalliance fms01 defensepact contiguity rogue, clust(cwkey) efron nolog nohr
stcox noalliance militaryaid defensepact contiguity rogue, clust(cwkey) efron nolog nohr

*excluding the "balanced" variable: reaction to the Reviewer #3's concern
logit irsd1 cwhost2 noalliance fms01 defensepact contiguity rogue, clust(cwkey) nolog
logit irsd1 cwhost2 noalliance militaryaid defensepact contiguity rogue, clust(cwkey) nolog

*including the "capability balance" variable: reaction to the Reviewer #3's concern
logit irsd1 bcap cwhost2 noalliance fms01 defensepact contiguity rogue, clust(cwkey) nolog
logit irsd1 bcap cwhost2 noalliance militaryaid defensepact contiguity rogue, clust(cwkey) nolog
stcox bcap noalliance fms01 defensepact contiguity rogue, clust(cwkey) efron nolog nohr
stcox bcap noalliance militaryaid defensepact contiguity rogue, clust(cwkey) efron nolog nohr

*including the "initiator" variable: reaction to the Reviewer #3's concern
logit irsd1 cwsidea1 cwhost2 noalliance fms01 defensepact contiguity rogue, clust(cwkey) nolog
logit irsd1 cwsidea1 cwhost2 noalliance militaryaid defensepact contiguity rogue, clust(cwkey) nolog
logit irsd1 cwrevis1 cwhost2 noalliance fms01 defensepact contiguity rogue, clust(cwkey) nolog
logit irsd1 cwrevis1 cwhost2 noalliance militaryaid defensepact contiguity rogue, clust(cwkey) nolog
stcox cwsidea1 noalliance fms01 defensepact contiguity rogue, clust(cwkey) efron nolog nohr
stcox cwsidea1 noalliance militaryaid defensepact contiguity rogue, clust(cwkey) efron nolog nohr
stcox cwrevis1 noalliance fms01 defensepact contiguity rogue, clust(cwkey) efron nolog nohr
stcox cwrevis1 noalliance militaryaid defensepact contiguity rogue, clust(cwkey) efron nolog nohr

log close
